package com.log4jviewer.ui.views;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;

/**
 * Class represents a handler for 'Clear' button. It removes all logs from log list and clears LogView table.
 * 
 * @author <a href="mailto:rd.ryly@gmail.com">Ruslan Diachenko</a>
 */
public class ClearLogsAction implements IViewActionDelegate {

    private LogView logView;

    @Override
    public void run(final IAction action) {
        logView.getLogList().clear();
        logView.clearLogTable();
    }

    @Override
    public void selectionChanged(final IAction action, final ISelection selection) {
        // no code
    }

    @Override
    public void init(final IViewPart view) {
        this.logView = (LogView) view;
    }
}
